<template>
  <ul class="todo-list">
    <!-- completed: 完成的类名 -->
    <li :class="{completed:item.isDo}" v-for="(item,index) in isList" :key="index" >
      <div class="view">
        <input class="toggle" type="checkbox" v-model="item.isDo"  @click="clickFn(index)"/>
        <label>{{item.name}}</label>
        <button class="destroy" @click="delFn(index)"></button>
      </div>
    </li>
  </ul>
  
</template>

<script>
import {mapMutations,mapGetters} from 'vuex'
export default {
  data() {
    return {
     
    }
  },
  computed:{
    // ...mapState(['list']),
    ...mapGetters(['isList'])
  },
  methods:{
    ...mapMutations(['setIsDo','delSetList']),
    clickFn(index){
  
this.setIsDo(index)
      
    },
    delFn(ind){
// console.log(ind);
this.delSetList(ind)
    }
  }

}
</script>